<%@ page language="java" contentType="application/octet-stream;charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.welfare.admin.service.*" %>
<%
	out.clear();
	out = pageContext.pushBody(); 
	
	
	String excelTitle = "복지자원목록";
	
	response.setHeader("Content-Disposition","attachment;filename="+java.net.URLEncoder.encode(excelTitle, "utf-8")+"_"+StringUtil.today()+".xls");
	response.setHeader("Content-Description","JSP Generated Data");
	

	HashBox box = new HashBox(request);

	String s_service_gubn		= box.getCheckedValue("s_service_gubn");
	String s_srch_age			= box.getCheckedValue("s_srch_age");
	String s_srch_target		= box.getCheckedValue("s_srch_target");
	String s_srch_family		= box.getCheckedValue("s_srch_family");
	String s_srch_income		= box.getCheckedValue("s_srch_income");
	String s_srch_support		= box.getCheckedValue("s_srch_support");
	String s_srch_needs			= box.getCheckedValue("s_srch_needs");
	String s_srch_period		= box.getCheckedValue("s_srch_period");
	String s_srch_time			= box.getCheckedValue("s_srch_time");
	String s_srch_weekday		= box.getCheckedValue("s_srch_weekday");
	
	String s_service_type		= StringUtil.nvl(request.getParameter("s_service_type"));
	String s_service_name		= StringUtil.nvl(request.getParameter("s_service_name"));
	String s_dept_name			= StringUtil.nvl(request.getParameter("s_dept_name"));
	String s_open_yn			= StringUtil.nvl(request.getParameter("s_open_yn"));

	String sort_col				= StringUtil.nvl(request.getParameter("sort_col"), "to_number(service_id)");
	String sort_asc				= StringUtil.nvl(request.getParameter("sort_asc"), "asc");

	HashMap infos = new HashMap();
	infos.put("service_type",	s_service_type);
	infos.put("srch_service_gubn",	s_service_gubn);
	infos.put("srch_age",		s_srch_age);
	infos.put("srch_target",	s_srch_target);
	infos.put("srch_family",	s_srch_family);
	infos.put("srch_income",	s_srch_income);
	infos.put("srch_support",	s_srch_support);
	infos.put("srch_needs",		s_srch_needs);
	
	infos.put("prg_period",		s_srch_period);
	infos.put("srch_time",		s_srch_time);
	infos.put("srch_weekday",	s_srch_weekday);
	
	infos.put("service_name",	s_service_name);
	infos.put("dept_name",		s_dept_name);
	infos.put("open_yn",		s_open_yn);
	infos.put("use_yn",			"Y");
	infos.put("sort_col", 		sort_col);
	infos.put("sort_asc", 		sort_asc);

	ServiceDAO dao 	= new ServiceDAO();
	HashList list 	= dao.selectServiceList(infos);

	list.setHeader("service_id", 	"번호", 		MetaData.ALIGN_CENTER);
	list.setHeader("service_gubn", 	"사업구분",	MetaData.ALIGN_LEFT);
	list.setHeader("service_name", 	"서비스명",	MetaData.ALIGN_LEFT);
	list.setHeader("dept_name", 	"담당부서",	MetaData.ALIGN_LEFT);
	list.setHeader("tel_no", 		"연락처",	MetaData.ALIGN_LEFT);
	list.setHeader("hit_count", 	"조회수",	MetaData.ALIGN_RIGHT);
	list.setHeader("open_yn", 		"공개여부",	MetaData.ALIGN_CENTER);
	
	list.writeToExcel(response, excelTitle);
%>
